package com.shelpe.services.tenant.item;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.shelpe.services.tenant.mongomodel.SimbadTask;
import com.shelpe.services.tenant.mongorepository.SimbadTaskRepository;

@Component("taskWriter")
public class TaskWriter implements ItemWriter<SimbadTask>{

	private static final Logger logger = LoggerFactory.getLogger(TaskWriter.class);
	
	@Autowired
	private SimbadTaskRepository taskRep;
	
	@Override
	public void write(List<? extends SimbadTask> items) throws Exception {
		// TODO Auto-generated method stub
		if(items != null && items.size() > 0){
			taskRep.save(items);	
		}
	}

}
